listbox: Fix keynav_failed() parameter in move_cursor()
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 8 Oct 2013 21:56:19 +0000 (23:56 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 11 Oct 2013 11:11:59 +0000 (13:11 +0200)
The 'direction' parameter to gtk_widget_keynav_failed() is based on
gtk_list_box_move_cursor()'s 'count' parameter. However if the passed
in movement is GTK_MOVEMENT_DISPLAY_LINES, 'count' is modified by
the keynav handling and will always be 0. To avoid messing up the
'direction' parameter, use a local variable for keynav handling and
leave 'count' untouched.

https://bugzilla.gnome.org/show_bug.cgi?id=709687

gtk/gtklistbox.c

index bcff01b3c5c16cecffa5bcc37b750ade18b737c4..a4ff50a3ab1a16152f09baa7ef80f919b029ca1c 100644 (file)
@@ -2277,17 +2277,18 @@ gtk_list_box_move_cursor (GtkListBox      *list_box,
     case GTK_MOVEMENT_DISPLAY_LINES:
       if (priv->cursor_row != NULL)
         {
+          int i = count;
           iter = ROW_PRIV (priv->cursor_row)->iter;
 
-          while (count < 0  && iter != NULL)
+          while (i < 0  && iter != NULL)
             {
               iter = gtk_list_box_get_previous_visible (list_box, iter);
-              count = count + 1;
+              i = i + 1;
             }
-          while (count > 0  && iter != NULL)
+          while (i > 0  && iter != NULL)
             {
               iter = gtk_list_box_get_next_visible (list_box, iter);
-              count = count - 1;
+              i = i - 1;
             }
 
           if (iter != NULL && !g_sequence_iter_is_end (iter))